package com.kotlin.lib.coroutines

import kotlinx.coroutines.*

fun main() = runBlocking<Unit> {
    val handler = CoroutineExceptionHandler { _, throwable ->
        println("exceptionHandler caught exception${throwable}")
    }
    val launch = GlobalScope.launch(handler) {
        throw AssertionError()
    }

    val async = GlobalScope.async(handler) {
        throw ArithmeticException()// 没有打印任何东西，依赖用戶去调用 deferred.await(
    }

    joinAll(launch, async)
}